package com.wms.controller.admin;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;
import java.util.Map;

public class BaseController {

    protected Logger logger = LoggerFactory.getLogger(this.getClass());

    public static Object unauthorize(){
        Map<String, Object> result = new HashMap<String, Object>();
        result.put("code", 401);
        result.put("msg", "未登录");
        return result;
    }

    public static Object unPermission(){
        Map<String, Object> result = new HashMap<String, Object>();
        result.put("code", 403);
        result.put("msg", "未授权");
        return result;
    }

    public static Object error(String msg){
        Map<String, Object> result = new HashMap<String, Object>();
        result.put("code", 400);
        result.put("msg", msg);
        return result;
    }

    public static Object success(){
        Map<String, Object> result = new HashMap<String, Object>();
        result.put("code", 200);
        result.put("msg", "操作成功");
        return result;
    }

    public static Object success(Object data){
        Map<String, Object> result = new HashMap<String, Object>();
        result.put("code", 200);
        result.put("msg", "操作成功");
        result.put("data", data);
        return result;
    }


}
